﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Threading;
using System.Diagnostics;
using System.Windows.Forms;
using System.Timers;
using System.IO;
using System.ComponentModel;
using YukiFX5017.Core;

namespace YukiFX5017
{
    public class GlobalTimers
    {
        public static int AutoSave = 0;

        public static void EveryTenMillisecond(object sender, ElapsedEventArgs e)
        {
            #region Monster.Timer
            foreach (var DE in Kernel.Mobs)
            {
                Mob Mob = DE.Value;

                #region ActionHandler
                Mob.CurrentActionSpeed += 100;
                if (Mob.CurrentActionSpeed >= Mob.ActionSpeed)
                {
                    Mob.ActionHandle();
                    Mob.CurrentActionSpeed = 0;
                }
                #endregion
            }
            #endregion
            #region CharTimer
            foreach (var DE in Kernel.Chars)
            {
                Character Charr = DE.Value;

                #region Auto500MillisecondTimer
                Charr.CharTimer += 100;
                if (Charr.CharTimer >= 500)
                {
                    Charr.TimerElapsed();
                    Charr.CharTimer = 0;
                }
                #endregion
            }
            #endregion
        }
    }
}
